<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>

<style type="text/css">
	body{font-size:13px}
	.clsTip{border:#ccc 1px solid;background-color:#eee;margin-top:15px;padding:5px;width:185px;display:none}
	.txt{border:#666 1px solid;padding:3px;}
</style>
<script type="text/javascript" src="../../js/jquery-2.1.1.min.js"></script>
<script type="text/javascript">
	//bind的第二个参数可选，表示作为event.data属性的值传递到事件对象的额外数据对象
	$(function(){
		var message = "执行的是focus事件";
		$(".txt").bind("focus",	{msg:message},function(event){
				$("#divTip").show().html(event.data.msg);	
			});
		message = "执行的是change事件";
		$(".txt").bind("change",{msg:message},function(event){
				$("#divTip").show().html(event.data.msg);
		});
	});
	//
</script>
</head>
<body>
	<div>姓名：<input type="text" class="txt" /></div>
	<div id="divTip" class="clsTip" ></div>
</body>
</html>